package ee.az.tetris.timer;

import ee.az.tetris.Dispatcher;
import ee.az.tetris.event.Event;

/**
 * @author Artur Zinatullin (artur.zinatullin@gmail.com) 2010
 */
public abstract class EventFiringTimer extends Timer {

	private final Dispatcher dispatcher;
	
	public EventFiringTimer(int period, Dispatcher dispatcher) {
		super(period);
		this.dispatcher = dispatcher;
	}

	protected abstract Event getEvent();

	@Override
	public void tick() {
		dispatcher.dispatch(getEvent());
	}
}
